// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;
class A {
    private a: number = 0;
    private b: number = 0;
}

class B extends A {
    private c: number = 0;
}

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.RichText)
    label: cc.RichText = null;

    @property
    text: string = 'hello';

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {
        // cc.log(B);
        let des = Object.getOwnPropertyDescriptor(this.label["__proto__"], "string");
        let self = this;
        let setter = function (value) {
            des.set.call(self.label, value);
        }

        let getter = function () {
            return des.get.call(self.label,);
        }

        Object.defineProperty(this.label, "string", {
            enumerable: des.enumerable,
            configurable: des.configurable,
            set: setter,
            get: getter
        });

        this.label.string = "hello world";
        let count = 0;
        this.schedule(() => {
            // this.label.string = count+++"";
        
        }, 1, 7);
    }

    // update (dt) {}
}
